<template>
  <div
    class="relative flex flex-col w-full"
    :class="[
      'mt-' + (info.extension.topMargin && info.extension.topMargin.value),
      'mr-' + (info.extension.rightMargin && info.extension.rightMargin.value),
      'mb-' + (info.extension.bottomMargin && info.extension.bottomMargin.value),
      'ml-' + (info.extension.leftMargin && info.extension.leftMargin.value),
    ]"
    :style="{
      '--timeHeight': `${info.extension.boxHeight.value}px`,
      '--timeTheme': info.extension.titleBgColor.value,
      '--fontColor': info.extension.titleColor.value,
    }"
  >
    <el-date-picker
      v-model="text"
      format="YYYY/MM/DD HH:mm:ss"
      popper-class="popperClass"
      :range-separator="info.extension.separator.value"
      :type="info.extension.type.value"
      value-format="YYYY/MM/DD HH:mm:ss"
      @change="changeDate"
    />
  </div>
</template>
<script>
  import { defineComponent } from 'vue'
  import { UiMixin, RefsInjectMixin, ChartMixin } from '@ve/mixin'
  export default defineComponent({
    name: 'UiTimeDate',
    mixins: [UiMixin, RefsInjectMixin, ChartMixin],
    inject: {
      hasPreview: { default: false },
    },
    props: {
      info: {
        required: true,
        type: Object,
        default: function () {
          return {}
        },
      },
    },
    data() {
      return {
        text: '',
      }
    },
    watch: {},
    created() {},
    mounted() {},
    methods: {
      changeDate(str) {
        console.log(str)
        // return con
      },
    },
  })
</script>
<style lang="scss">
  .uiTimeDate {
    width: 100%;
    /* overflow: hidden; */
    .popperClass {
      .el-picker-panel {
        background: #000 !important;
        color: #fff;
      }
    }
  }
</style>
